<template>
	<view class="b_width">
		<u-navbar leftIconColor="black" :autoBack="true" :title="title" titleStyle="color:black" :placeholder="true"
			bgColor="#fff">
		</u-navbar>
		<view class="content_box">
			<rich-text :nodes="info.content" class="content"></rich-text>
		</view>
	</view>
</template>

<script>
	import {
		articleList
	} from "@/require/api.js";
	export default {
		props: {
			type: {
				type: [Number, String],
				default: 1
			}
		},
		data() {
			return {
				title: '强乐邦用户协议',
				params: {
					cid: 746,
					page: 1,
					limit: 10
				},
				info: {}
			}
		},
		onLoad(data) {
			console.log(data);
			if (data.type) {
				switch (data.type) {
					case '1':
						this.title = '用户及付款协议';
						this.params.cid = 750;
						break;
					case '2':
						this.title = '租赁免责协议';
						this.params.cid = 751;
						break;
				}
			}
		},
		onShow() {

			this.getInfo();
		},
		methods: {
			async getInfo() {
				let {
					data
				} = await articleList(this.params.cid, this.params);
				this.info = data.list[data.list.length - 1];
				if (this.info.content) {
					this.info.content = this.$project.formatRichText(this.info.content).replace(/src="\//g,
						'src="' + this.$imgUrl
						.imgRemote + '/');
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	::v-deep .u-navbar__content__title {
		font-size: 32rpx !important;
		font-weight: bold;
		color: #252B50 !important;
	}

	.content_box {
		box-sizing: border-box;
		padding: 40rpx;
		line-height: 80rpx;
	}
</style>